<ul>
<?php

$categories = GetAllCategories();
foreach($categories as $cat)
{
	$contests = GetContestsByCategoryId($cat->id);
	echo '<li><a href="' . MC_ROOT. 'contests.php?id=' . $cat->id . '">' . stripslashes($cat->title) . '</a></li><ul>';
	foreach($contests as $contest)
	{
		echo '<li<?php echo (in_array(' . $contest->id . ', $profil->contestcompleted)?\' class="profil_contest_validated"\':\' class="profil_contests"\') ?>>' . '<a href="' . MC_ROOT . 'contest.php?id=' . $contest->id . '">' . stripslashes($contest->title) . '</a></li>';
	}
	echo '</ul><br />';
}

?>
</ul>